<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>博客</title>
    <link href="<%=basePath%>bootstrap/css/blog-home.css"/>
    <link href="<%=basePath%>bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="<%=basePath%>bootstrap/js/jquery-2.1.1.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">轻博客</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-ex1-collapse">
            <ul class="nav navbar-nav">
                <li><a href="<%=path%>/user?method=index">首页</a></li>
            </ul>
            <c:if test="${null!=user}">
                <ul class="nav navbar-nav">
                    <li><a href="<%=basePath %>user?method=myblog&userId=${user.id}">我的博客</a></li>
                </ul>
                <ul class="nav navbar-nav">
                    <li><a href="<%=basePath %>article?method=manage&userId=${user.id}"><i class="icon-cog"></i> 博文管理</a></li>
                    <li><a href="<%=basePath %>category?method=manage&userId=${user.id}"><i class="icon-cog"></i> 分类管理</a></li>
                    <li><a href="<%=basePath %>comment?method=manage&userId=${user.id}"><i class="icon-cog"></i> 评论管理</a></li>
                </ul>
            </c:if>
            <c:if test="${null==user}">
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="<%=path%>/login.jsp" target="_self">登录</a></li>
                    <li><a href="<%=path%>/register.jsp" target="_self">注册</a></li>
                </ul>
            </c:if>
            <c:if test="${user!=null}">
                <div class="pull-right">
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="#">欢迎，${user.userName}</a></li>
                        <li><a href="<%=basePath%>user?method=profile&id=${user.id}"><i class="glyphicon glyphicon-cog"></i> 编辑个人信息</a></li>
                        <c:if test="${user.isApplied==1}">
                            <li><a href="<%=basePath%>user?method=bloginfo&userId=${user.id}"><i class="glyphicon glyphicon-cog"></i> 编辑博客信息</a></li>
                        </c:if>
                        <li><a href="<%=path%>/user?method=logout"><i class="glyphicon glyphicon-off"></i> 登出</a></li>
                    </ul>
                    </li>
                    </ul>
                </div>
            </c:if>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container -->
</nav>
<c:if test="${null != errorAddMsg}">
    <div class="container" style="position:absolute;top: 55px;left:360px" >
        <div class="alert alert-warning">${errorAddMsg}</div>
    </div>
    <%
        request.getSession().removeAttribute("errorAddMsg");
    %>
</c:if>
<div class="container " style="position: absolute;top: 120px;left: 360px">
    <ol class="breadcrumb">
        <li><a href="<%=basePath%>category?method=manage&userId=${user.id}">分类管理</a></li>
        <li class="active">新建分类</li>
    </ol>
    <form class="form-horizontal" name="add_category_form" action="<%=basePath %>category?method=add&userId=${user.id}" method="post" onsubmit="return isValidate(add_category_form)">
        <div class="col-md-6">
            <div class="from-group">
                <label for="category_name">分类名：</label>
                <input class="form-control" id="category_name" name="category_name" type="text">
            </div>
            <div class="from-group">
                <button id="add_category_submit" type="submit" class="btn btn-primary">保存</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function isValidate(form) {
        var category_name = form.category_name.value;

        if (category_name == "") {
            alert("请填写分类名！");

            return false;
        }
        return true;
    }
</script>
<div class="container" style="position: absolute;bottom: 10px;left:400px">
    <hr>
    <footer style="text-align: center">
        <div class="row">
            <div class="col-lg-12">
                <p>
                    &middot;网站创建到目前访问人数：<%=(Integer)session.getAttribute("num") %>
                </p>
            </div>
        </div>
    </footer>
</div>
<div><audio autoplay="autoplay" loop="true"><source src="music/1.mp3"></audio></div>
</body>
</html>
